package com.example.simin_manage.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @description:
 * @author: panpan
 * @time: 2025/9/14
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")                // 所有路径
                .allowedOriginPatterns("*")       // 允许所有来源
                .allowedMethods("GET","POST","PUT","DELETE") // 允许的方法
                .allowCredentials(true)           // 允许 cookie
                .allowedHeaders("*");             // 允许所有头
    }
}